package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.QualityQarTaskQueryService;
import cc.comac.mom.bean.QualityQarTaskQuery;
import cc.comac.mom.util.ResultBean;

@RestController
@RequestMapping("/QualityQarTaskQuery")
public class QualityQarTaskQueryController {

	@Autowired
	private QualityQarTaskQueryService QualityQarTaskQueryService;
	
	@RequestMapping(value = "/selectByFields", method = RequestMethod.POST)
	public ResultBean selectByFields(@RequestBody QualityQarTaskQuery qualityQarTaskQuery) {
		ResultBean selectByFields = QualityQarTaskQueryService.selectByFields(qualityQarTaskQuery);
		return selectByFields;
	}

	// 当手动生成qar任务时，进行任务合拼
	@RequestMapping(value = "/qarTaskMerge", method = RequestMethod.POST)
	public ResultBean qarTaskMerge(@RequestBody List<QualityQarTaskQuery> list) {
		ResultBean qarTaskMerge = QualityQarTaskQueryService.qarTaskMerge(list);
		return qarTaskMerge;
	}

	// 当手动生成qar任务时，进行任务单个的生成
	@RequestMapping(value = "/qarTaskSingleInsert", method = RequestMethod.POST)
	public ResultBean qarTaskSingleInsert(@RequestBody List<QualityQarTaskQuery> list) {
		ResultBean qarTaskSingleInsert = QualityQarTaskQueryService.qarTaskSingleInsert(list);
		return qarTaskSingleInsert;
	}
	
	@RequestMapping(value = "/selectMyselfByFields", method = RequestMethod.POST)
	public ResultBean selectMyselfByFields(@RequestBody QualityQarTaskQuery qualityQarTaskQuery) {
		ResultBean selectMyselfByFields = QualityQarTaskQueryService.selectMyselfByFields(qualityQarTaskQuery);
		return selectMyselfByFields;
	}
}
